<%
  #File :   /app/views/documents/list.rhtml
  #Author:  Andrew Stone
  #Created: 08.25.2006
%> 
<%=start_large_div_wrapper%>
  <div id="page_title">Listing Document Categories
    <%=pagination(@category_pages)%>
  </div>

  <div id="large">
    <table>
      <thead>
        <tr>
          <td>Name</td>
          <td>Pages</td>
          <td>Kb</td>
          <td>Actions</td>
        </tr>
      </thead>
      <tbody>
      <%
          i = 0
          @categories.each{|ct|
            bg = row_class(i)
            i += 1
      %>
            <tr class="<%=bg%>">
              <td><%=h(ct.name)%></td>
              <td>
                <% if ct.page.length == 0 %>
                    &nbsp;
                <% else 
                      ct.page.each do |pg| %>
                        <%=pg.qualified_name%><br/>
                <%    end
                   end %>

              </td>
              <td align="right"><%=ct.total_kilobytes%>&nbsp;</td>
              <td class="action">
                <%=secure_links([
                secure_link_to("Manage", ca("/manage/documents","manage_files", ct.id)),
                secure_link_to("Update", ca("/manage/documents","update", ct.id)),
                secure_link_to("Delete", ca("/manage/documents","delete", ct.id), :confirm => "Are you sure? This will remove all uploaded documents.")
                ])%>
              </td>
            </tr>
      <% 
          } %>
      </tbody>  
    </table>
    <div id="actions">
        <%=secure_link_to("Create new category",{:controller => "/manage/documents", :action => "create"})%>
    </div>
  </div>
<%=end_div_wrapper%>
